﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DelonixRegiaHMSys.Core.Services;
using DelonixRegiaHMSys.Infrastructure.Data;
using DelonixRegiaHMSys.Core.Models;

namespace DelonixRegiaHMSys.UI.WebForms
{
    public partial class UpdateGuestParticular : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                lblguestID.Text = Request.QueryString["Guest ID"];
                lblguestFirstName.Text = Request.QueryString["GuestFirstName"];
                lblguestLastName.Text = Request.QueryString["GuestLastName"];
                tbxhomeAddress.Text = Request.QueryString["Home Address"];
                ddlnationality.Text = Request.QueryString["Nationality"];
                tbxcontactNum.Text = Request.QueryString["Contact Number"];
                tbxemailAddress.Text = Request.QueryString["Email Address"];
                tbxmailAddress.Text = Request.QueryString["Mail Address"];
            }
        }

        protected void btnupdate_Click(object sender, EventArgs e)
        {
            GuestParticular gp = new GuestParticular();
            gp.GuestID = lblguestID.Text;
            gp.GuestLastName = lblguestLastName.Text;
            gp.GuestFirstName = lblguestFirstName.Text;
            gp.HomeAddress = tbxhomeAddress.Text;
            gp.Nationality = ddlnationality.Text;
            gp.ContactNum = Convert.ToInt32(tbxcontactNum.Text);
            gp.EmailAddress = tbxemailAddress.Text;
            gp.MailAddress = tbxmailAddress.Text;

            var gpservice = new gpServices(new EfGuestParticularQuery());
            gpservice.UpdateGuest(gp);
            Response.Redirect("~/WebForms/RetrieveGuestParticular.aspx", true);
        }

    }
}